#ifndef NANE_PNGIMAGEDECODER_H
#   define  NANE_PNGIMAGEDECODER_H

#   include "nane/CodecSystem/Image/IImageCodecSystem.h"
#   include "nane/core/crt/FileSystem.h"
#   include "png.h"

namespace nane 
{
    class PNGImageDecoder
        : public IImageDecoder
    {
    public:
        PNGImageDecoder();
        ~PNGImageDecoder();
        
        bool Initialize( IInputRef* _input );
        void Shutdown();
        
    public:
        uint32 Read( byte* _buffer, uint32 _count );
        
        uint32 GetWidth();
        uint32 GetHeight();
        EPixelFormat::raw_type GetFormat();
        
    private:
        InputPtr m_inputPtr;
        uint32 m_width;
        uint32 m_height;
        EPixelFormat m_format;
        png_structp m_png;
        png_infop m_pngInfo;
        uint32 m_rowSizeInBytes;
    };
}   // namespace nane

#endif	// NANE_PNGIMAGEDECODER_H
